/* 
    这里定义和路由相关的路由处理函数，供 /router/user.js 使用
*/
const Dao = require('../server/index')
const dao = new Dao("mongodb://localhost:27017", "test", "user")

// 获取新闻列表
exports.getNewsList = (req, res) => {
    // res.send('ok')
    console.log("req", req)
    let query = req.query.query || {}
    dao.queryAll(query).then((results) => {
        console.log("results", results)
        if (results == null) {
            res.send({
                status: 0,
                msg: "到底了！"
            })
        } else {
            res.send({
                status: 0,
                msg: "查询成功！",
                data: results
            })
        }
    }).catch({

    })
}
